package cn.com.joycode.admin.entrance.configuration;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Slf4j
@Configuration
public class NimbleAdminWebMvcConfigurer implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        try {
//            String imagesPath = ResourceUtil.getResource("images").getPath();
//            File file = new File(imagesPath);
//            if (file.exists()) {
//                log.info("imagesPath:{}", imagesPath);
//                registry.addResourceHandler("/images/**").addResourceLocations("file:"+imagesPath+"/");
//            }
        } catch (Exception e) {
            log.error("加载资源路径失败", e);
        }
    }
}
